home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: cwi.nl!dik
- From: dik@cwi.nl (Dik T. Winter)
- Subject: Re: Matrix Multiplication
- Message-ID: <DLqw5A.Iqy@cwi.nl>
- Sender: news@cwi.nl (The Daily Dross)
- Nntp-Posting-Host: chrysant.cwi.nl
- Organization: CWI, Amsterdam
- References: <1996Jan22.110440@gamma.ntu.ac.sg> <4e4fa7$51o@news.cencom.net>
- Date: Thu, 25 Jan 1996 16:22:22 GMT
-
- In article <4e4fa7$51o@news.cencom.net> tanp@ns (Bill Wendling) writes:
- > Long inexplicably wrote:
- > } Dear all,
- >
- > } I would like to know whether anyone of you out there has better ways to
- > } do matrix multiplication (optimised for speed) in C either than using
- > } two nested for loops.
- >
- > Try using Gaussian Elimination to make the array have either only
- > values on the diagnol or one value...Then multiply with just one for loop.
-
- Eh? G.E. is order n^3 the same as matrix-matrix multiplication.
- However, matrix-matrix multiplication requires three nested loops,
- matrix-vector multiplication (order n^2) requires two nested loops.
- For matrix-vector multiplication there is nothing better, matrix-matrix
- can be done better, you will find some algorithms in Knuth. Be aware
- however that the algorithm by Winograd will only be faster if the
- elementary multiplication is much slower than the elementary addition.
- The algorithm trades multiplications for (more) additions/subtractions
- and does not really have better order. There are other algorithms that
- are really better but they require in general large matrices.
- --
- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924098
- home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
-